package com.dao.shopping;

import com.entry.Shopping;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ShoppingMapper {
    public List<Shopping> getShoppingListPay(@Param("member_id")int member_id);

    public List<Shopping> getShoppingListPayList(@Param("member_id")int member_id,@Param("product_id")int product_id);

    public List<Shopping> getShoppingList(@Param("member_id")int member_id);
    public List<Shopping> cartdelList();
    //查询客户商品的数量
    public int getCount(@Param("member_id")int member_id);
    //添加商品
    public int addCart(@Param("member_id") int member_id,@Param("product_id") int product_id,@Param("shopping_product_amount") int shopping_product_amount);

    //添加商品checked=3
    public int addCartChecked(@Param("member_id") int member_id,@Param("product_id") int product_id,@Param("shopping_product_amount") int shopping_product_amount,@Param("shopping_checked") int shopping_checked);

    int updateCartChecked(@Param("product_id") int product_id,@Param("member_id") int member_id,@Param("shopping_checked")int shopping_checked);

    //更新添加商品的数量
    public int updateCartCount(@Param("member_id") int member_id,@Param("product_id") int product_id,@Param("shopping_product_amount") int shopping_product_amount);

    //查询购物车是否有相同的商品
    public Shopping getCountById(@Param("member_id") int member_id,@Param("product_id") int product_id);

    //根据member_id，product_id删除购物车的商品Checked=1
    public int delCartProduct(@Param("member_id") int member_id,@Param("product_id") int product_id);

    public int delCartProducts(int member_id);

    //根据member_id，product_id删除购物车的商品Checked=3
    public int delCartProductByChecked(@Param("member_id") int member_id,@Param("product_id") int product_id);

    //根据member_id，shopping_checked删除购物车的商品
    public int delCartProductByCheckeds(@Param("member_id")int member_id,@Param("shopping_checked")int shopping_checked);

    //根据member_id清空购物车
    public int delCartProductById(@Param("member_id") int member_id);
}
